home *** CD-ROM | disk | FTP | other *** search
- #!/usr2/local/bin/perl -w
-
- require "cgilib.pl";
-
- #
- # Configurable Variables
- #
- $SENDMAIL = '/usr/bin/sendmail';
- $TO = 'kgr';
- $SUBJECT = 'Survey Results';
- $BACK = '<A HREF="/kgr/book">Back to my Homepage</A>';
- @FIELDS = qw(name email street city state zip rating comments);
-
- # Output the HTML content type
- print "Content-type: text/html\n\n";
-
- # Initialize a hash of CGI arguments using
- # routines from cgilib.pl
- readParse(*dict);
-
- # Build the 'from' address of the form:
- # "email address, (real name)"
- my $from = "$dict{email}, ($dict{name})";
-
- # The -t causes the To: field to be read from standard input
- # instead of being expected on the command line. The -oi
- # prevents a dot on a line by itself from being interpreted
- # as a message terminator.
- open MAIL, "|$SENDMAIL -t -oi";
-
- # Output the mail header
- print MAIL <<EOMH;
- Reply-to: $from
- From: $from
- To: $TO
- Subject: $SUBJECT
-
- EOMH
-
- # Output the mail body
- foreach (@FIELDS)
- {
- print MAIL "<", uc($_), ">\n $dict{$_}\n\n";
- }
-
- # Output the mail footer
- print MAIL <<EOMF;
-
- <REMOTE HOST>
- $ENV{'REMOTE_HOST'}
-
- <REMOTE ADDRESS>
- $ENV{'REMOTE_ADDR'}
-
- <USER AGENT>
- $ENV{'HTTP_USER_AGENT'}
-
- EOMF
-
- # Close the pipe, sending the mail
- close MAIL;
-
- # Generate HTML notification
- print <<EOH;
- <HTML><BODY>
- <H1>Thanks!</H1>
- Your comments have been noted.<BR>
- <BR>
- Your response:
- <TABLE>
- EOH
-
- # Output the mail body
- foreach (@FIELDS)
- {
- $val = $dict{$_};
- $val =~ s/</</g;
- $val =~ s/>/>/g;
- print qq{<TR><TH ALIGN="LEFT">}, uc($_), "<TD>$dict{$_}<BR>";
- }
-
- print "</TABLE><BR>$BACK</BODY></HTML>";
-
- 1;
-